load("@rules_java//java:java_library.bzl", "java_library")

package(
    default_applicable_licenses = ["//:license"],
    default_testonly = True,
    default_visibility = [
        "//testing/testrunner:__pkg__",
    ],
)

java_library(
    name = "test_executor",
    srcs = ["TestExecutor.java"],
    tags = [
    ],
    deps = [
        ":annotations",
        ":cel_test_suite",
        ":cel_test_suite_exception",
        ":cel_test_suite_text_proto_parser",
        ":cel_test_suite_yaml_parser",
        ":cel_user_test_template",
        ":junit_xml_reporter",
        "//testing/testrunner:class_loader_utils",
        "@maven//:com_google_guava_guava",
        "@maven//:io_github_classgraph_classgraph",
        "@maven//:junit_junit",
    ],
)

java_library(
    name = "junit_xml_reporter",
    srcs = ["JUnitXmlReporter.java"],
    tags = [
    ],
    deps = ["@maven//:com_google_guava_guava"],
)

java_library(
    name = "cel_user_test_template",
    srcs = ["CelUserTestTemplate.java"],
    tags = [
    ],
    deps = [
        ":cel_expression_source",
        ":cel_test_context",
        ":cel_test_suite",
        ":test_runner_library",
        "@maven//:junit_junit",
    ],
)

java_library(
    name = "test_runner_library",
    srcs = ["TestRunnerLibrary.java"],
    tags = [
    ],
    deps = [
        ":cel_expression_source",
        ":cel_test_context",
        ":cel_test_suite",
        ":registry_utils",
        ":result_matcher",
        "//bundle:cel",
        "//bundle:environment",
        "//bundle:environment_yaml_parser",
        "//common:cel_ast",
        "//common:compiler_common",
        "//common:options",
        "//common:proto_ast",
        "//common/internal:default_instance_message_factory",
        "//policy",
        "//policy:compiler_factory",
        "//policy:parser",
        "//policy:parser_factory",
        "//policy:validation_exception",
        "//runtime",
        "//testing:expr_value_utils",
        "//testing/testrunner:proto_descriptor_utils",
        "@cel_spec//proto/cel/expr:expr_java_proto",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "cel_test_suite",
    srcs = ["CelTestSuite.java"],
    tags = [
    ],
    deps = [
        "//:auto_value",
        "//common:source",
        "@maven//:com_google_errorprone_error_prone_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "cel_test_suite_yaml_parser",
    srcs = ["CelTestSuiteYamlParser.java"],
    tags = [
    ],
    deps = [
        ":cel_test_suite",
        ":cel_test_suite_exception",
        "//common:compiler_common",
        "//common/formats:file_source",
        "//common/formats:parser_context",
        "//common/formats:yaml_helper",
        "//common/formats:yaml_parser_context_impl",
        "//common/internal",
        "@maven//:com_google_guava_guava",
        "@maven//:org_yaml_snakeyaml",
    ],
)

java_library(
    name = "cel_test_suite_exception",
    srcs = ["CelTestSuiteException.java"],
    tags = [
    ],
    deps = ["//common:cel_exception"],
)

java_library(
    name = "cel_test_context",
    srcs = ["CelTestContext.java"],
    tags = [
    ],
    deps = [
        ":cel_expression_source",
        ":default_result_matcher",
        ":result_matcher",
        "//:auto_value",
        "//bundle:cel",
        "//common:options",
        "//policy:parser",
        "//runtime",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "registry_utils",
    srcs = ["RegistryUtils.java"],
    tags = [
    ],
    deps = [
        "//common/internal:default_instance_message_factory",
        "//testing/testrunner:proto_descriptor_utils",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "result_matcher",
    srcs = ["ResultMatcher.java"],
    deps = [
        ":cel_test_suite",
        "//:auto_value",
        "//bundle:cel",
        "//common/types:type_providers",
        "//runtime",
        "@cel_spec//proto/cel/expr:expr_java_proto",
        "@maven//:com_google_guava_guava",
    ],
)

java_library(
    name = "default_result_matcher",
    srcs = ["DefaultResultMatcher.java"],
    deps = [
        ":cel_test_suite",
        ":registry_utils",
        ":result_matcher",
        "//:java_truth",
        "//bundle:cel",
        "//common:cel_ast",
        "//runtime",
        "//testing:expr_value_utils",
        "@cel_spec//proto/cel/expr:expr_java_proto",
        "@maven//:com_google_protobuf_protobuf_java",
        "@maven//:com_google_truth_extensions_truth_proto_extension",
    ],
)

java_library(
    name = "cel_test_suite_text_proto_parser",
    srcs = ["CelTestSuiteTextProtoParser.java"],
    tags = [
    ],
    deps = [
        ":cel_test_suite",
        ":cel_test_suite_exception",
        ":registry_utils",
        "@cel_spec//proto/cel/expr:expr_java_proto",
        "@cel_spec//proto/cel/expr/conformance/test:suite_java_proto",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_protobuf_protobuf_java",
    ],
)

java_library(
    name = "annotations",
    srcs = ["Annotations.java"],
    tags = [
    ],
)

java_library(
    name = "cel_expression_source",
    srcs = ["CelExpressionSource.java"],
    tags = [
    ],
    deps = [
        "//:auto_value",
    ],
)

filegroup(
    name = "test_runner_binary",
    srcs = [
        "TestRunnerBinary.java",
    ],
)
